package com.bjpowernode.servlets;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class SomeServlet extends HttpServlet {
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		
		// 设置响应的MIME类型（video/mp4，image/jpg）
		// 其中可以指定MIME的字符编码，即响应体的字符编码
		response.setContentType("text/html;charset=UTF-8");
		
		// setCharacterEncoding()方法的使用前提是，之前必须要先使用setContentType()方法
		// setCharacterEncoding()方法用于修改ContentType的MIME类型字符编码
		// response.setCharacterEncoding("UTF-8");
		
		// 获取标准输出流
		PrintWriter out = response.getWriter();
		
		// 向标准输出流中写入数据，那么客户端浏览器就会直接看到这些数据
		/*
		out.append("abc");
		out.append("def");
		*/
		/*out.print("abc");
		out.println("def");
		out.print("ghi");*/
		
		out.write("www.bjpowernode.com");
		out.write("北京动力节点");
		
		
		// 对标准输出流的关闭
		out.close();
		
	}

}
